﻿/* ----------------------------------------------------------------

	This file is part of TCP/IP Message Manager
	
	Copyright (C) 2014 Aleksejs Belezjaks http://alexbelezjaks.com
	
	TCP/IP Message Manager is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    TCP/IP Message Manager is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
	--------------------------------------------------------------- */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace MsgManager
{
    /// <summary>
    /// Client connected arguments event
    /// </summary>
    public class ClientConnectedArgs : EventArgs
    {
        private Client client;
        public Client Client
        {
            get { return client; }
        }

        public ClientConnectedArgs(Client client)
        {
            this.client = client;
        }
    }

    /// <summary>
    /// Message received arguments event
    /// </summary>
    public class MessageReceivedArgs : EventArgs
    {
        private Message message;
        public Message Message
        {
            get { return message; }
        }

        private Client client;
        public Client Client
        {
            get { return client; }
        }

        public MessageReceivedArgs(Message message, Client client)
        {
            this.message = message;
            this.client = client;
        }
    }

    /// <summary>
    /// Message send result arguments event
    /// </summary>
    public class MessageSendResultArgs : EventArgs
    {
        public Message Message;
        public Client Client;
        public Exception Exception;
        public bool Success;

        public MessageSendResultArgs(Message message, Client client, Exception ex, bool success)
        {
            this.Message = message;
            this.Client = client;
            this.Exception = ex;
            this.Success = success;
        }
    }

    /// <summary>
    /// Arguments for sending message thread.
    /// Should be only used internally
    /// </summary>
    public class SendMessageThreadArgs : EventArgs
    {
        private Client client;
        public Client Client
        {
            get { return client; }
        }

        private Message message;
        public Message Message
        {
            get { return message; }
        }

        public SendMessageThreadArgs(Client client, Message message)
        {
            this.client = client;
            this.message = message;
        }
    }

    /// <summary>
    /// Arguments for server connected event
    /// </summary>
    public class ServerConnectedArgs : EventArgs
    {
        private Client client;
        public Client Client
        {
            get { return client; }
        }

        private IPEndPoint target;
        public IPEndPoint Target
        {
            get { return target; }
        }

        public ServerConnectedArgs(Client client, IPEndPoint target)
        {
            this.client = client;
            this.target = target;
        }
    }
}
